<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>验证一个格里高里日期</title>
 </head>
 <body class="docs"><div id="layout">
  <div id="layout-content"><div id="function.checkdate" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">checkdate</h1>
  <p class="verinfo">(PHP 4, PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">checkdate</span> &mdash; <span class="dc-title">验证一个格里高里日期</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.checkdate-description">
  <h3 class="title">说明</h3>
   <div class="methodsynopsis dc-description">
    <span class="methodname"><strong>checkdate</strong></span>
     ( <span class="methodparam"><span class="type">int</span> <code class="parameter">$month</code></span>
    , <span class="methodparam"><span class="type">int</span> <code class="parameter">$day</code></span>
    , <span class="methodparam"><span class="type">int</span> <code class="parameter">$year</code></span>
    ) : <span class="type">bool</span></div>

    <p class="para rdfs-comment">
    检查由参数构成的日期的合法性。如果每个参数都正确定义了则会被认为是有效的。
  </p>
   </div>

 
  <div class="refsect1 parameters" id="refsect1-function.checkdate-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<code class="parameter">month</code></dt>

     <dd>

      <p class="para">
       month 的值是从 1 到 12。
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">day</code></dt>

     <dd>

      <p class="para">
          <code class="parameter">Day</code> 的值在给定的 <code class="parameter">month</code>
                所应该具有的天数范围之内，闰年已经考虑进去了。
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">year</code></dt>

     <dd>

      <p class="para">
       year 的值是从 1 到 32767。
      </p>
     </dd>

    
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.checkdate-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   如果给出的日期有效则返回 <strong><code>TRUE</code></strong>，否则返回
   <strong><code>FALSE</code></strong>。
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.checkdate-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-2700">
    <p><strong>Example #1 <span class="function"><strong>checkdate()</strong></span> 例子</strong></p>
    <div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">checkdate</span><span style="color: #007700">(</span><span style="color: #0000BB">12</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">31</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">2000</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">checkdate</span><span style="color: #007700">(</span><span style="color: #0000BB">2</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">29</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">2001</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
    </div>

    <div class="example-contents"><p>以上例程会输出：</p></div>
    <div class="example-contents screen">
<div class="cdata"><pre>
bool(true)
bool(false)
</pre></div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.checkdate-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="mktime.html" class="function" rel="rdfs-seeAlso">mktime()</a> - 取得一个日期的 Unix 时间戳</span></li>
    <li class="member"><span class="function"><a href="strtotime.html" class="function" rel="rdfs-seeAlso">strtotime()</a> - 将任何字符串的日期时间描述解析为 Unix 时间戳</span></li>
   </ul>
  </p>
 </div>

</div></div></div></body></html>